/*
 * Copyright 2017 The Cartographer Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef CARTOGRAPHER_MAPPING_GLOBAL_TRAJECTORY_BUILDER_H_
#define CARTOGRAPHER_MAPPING_GLOBAL_TRAJECTORY_BUILDER_H_

#include <memory>

#include "mapping/local_trajectory_builder_2d.h"

namespace cartographer {
namespace mapping {

class GlobalTrajectoryBuilder {
public:
  // Passing a 'nullptr' for 'local_trajectory_builder' is acceptable, but no
  // 'TimedPointCloudData' may be added in that case.
  GlobalTrajectoryBuilder(const int trajectory_id, std::shared_ptr<Publisher> publisher_ptr = nullptr);
    
  ~GlobalTrajectoryBuilder() {}

  // 禁用拷贝构造函数与赋值运算符
  GlobalTrajectoryBuilder(const GlobalTrajectoryBuilder&) = delete;
  GlobalTrajectoryBuilder& operator=(const GlobalTrajectoryBuilder&) = delete;

  void AddSensorData(const std::string& sensor_id, const sensor::TimedPointCloudData& timed_point_cloud_data);
  void AddSensorData(const std::string& sensor_id, const sensor::ImuData& imu_data);
  void AddSensorData(const std::string& sensor_id, const sensor::OdometryData& odometry_data);
   
private:
  const int trajectory_id_;
  std::unique_ptr<LocalTrajectoryBuilder2D> local_trajectory_builder_2d_ptr_;  // 模板参数
  std::shared_ptr<Publisher> publisher_ptr_ = nullptr;
};

}  // namespace mapping
}  // namespace cartographer

#endif  // CARTOGRAPHER_MAPPING_INTERNAL_GLOBAL_TRAJECTORY_BUILDER_H_
